const Koa = require('koa');
const Router = require('koa-router');
const bodyParser = require('koa-bodyparser');

const root = 'public';
const app = new Koa();
const router = new Router();

app.use(require('koa-static')(root));
app.use(bodyParser());

router.post('/test', (ctx, next) => {
  ctx.body = 'test'
})

router.post('/v1/Sixgreat/index', (ctx, next) => {
  let reqData = ctx.request.body
  console.log(ctx.request.body);
  ctx.body = {
    "code":2333,
    "msg":"ok",
    "time":"1555659554",
    "data":{
      qd: reqData.qd,
      posid: reqData.posid
    }
  }
})

app
  .use(router.routes())
  .use(router.allowedMethods());

app.listen(3000);